
/*------------------------------------------------------------------------------

							PREPARE DATA

------------------------------------------------------------------------------*/

* regulatory filings

use "$output/DA", clear

* returns

gen Pa_ig = PM_ouv_ig + (Inflow_ig-Outflow_ig)/2
gen y = Revalo_ig/Pa_ig
gen x = Retass_ig/Pa_ig
sort matricule year
gen lx = l.x

* reserves

gen res0 = (Reserve_PPB_ig_lag + Reserve_RC_ig_lag + Reserve_unrealized_lag) / PM_ouv_ig if abs(alpha_ig-1)<.05

* portfolio shares

foreach x in stock bond re loan {
gen share_`x' = Asset_`x'_mrkt/Asstot_mrkt
gen l2share_`x' = l2.share_`x'
}

keep if res0<.

* merge with prospectus data

merge 1:m matricule year using "$source/profideo_contract"

* keep if certain match (certainty==1 <=> we are sure this is the right matricule)

keep if _merge==3 & certainty==1 
drop _merge

* keep open contracts

keep if year>=date_creation & year<=date_fermeture
keep if fee_entry+fee_mngt<.

* collapse at the insurer-year level across all contracts

collapse (mean) PM_clo_ig res0 lx l2share_* fee_entry fee_mngt, by(matricule year)

* value-weight across insurers

qui gen w = .
qui egen PMagg = sum(PM_clo_ig), by(year)
qui replace w = PM_clo_ig/PMagg
drop PMagg

save "$output/profideo_DA", replace




/*------------------------------------------------------------------------------

					TABLE 1 PANEL B: SUMMARY STATS

------------------------------------------------------------------------------*/

use "$output/profideo_DA", clear

replace fee_mngt = fee_mngt*100
label var fee_mngt "Management fee (\%)"

replace fee_entry = fee_entry*100
label var fee_entry "Entry fee (\%)"

eststo clear

estpost tabstat fee_mngt fee_entry [aw=w], stat(mean sd p25 p50 p75 count) col(stat)

estout using "$results/sum-stat-fee.tex", replace style(tex) cells("mean(fmt(%12.2g) label(Mean)) sd(fmt(%12.2g) label(S.D.)) p25(fmt(%12.2g) label(P25)) p50(fmt(%12.2g) label(P50)) p75(fmt(%12.2g) label(P75)) count(fmt(%12.0fc) label(N))") label mlabels(none) collabels(none) varwidth(50)





/*------------------------------------------------------------------------------

					TABLE 4 COLUMNS 1-2: FEES REGRESSIONS

------------------------------------------------------------------------------*/

use "$output/profideo_DA", clear

label var res0 "Lagged reserves"

eststo clear

qui eststo: reghdfe fee_entry res0 [aw=w], a(year matricule) vce(cluster matricule year)

qui eststo: reghdfe fee_mngt res0 [aw=w], a(year matricule) vce(cluster matricule year)

estout using "$results/fees.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) drop(_cons) mlabel(none) collabel(none) varwidth(30)

estout using "$results/fees_r2.tex", replace style(tex) label stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)




/*------------------------------------------------------------------------------

							TABLE E.1

------------------------------------------------------------------------------*/

* lagged asset return does not predict fees

use "$output/profideo_DA", clear

label var lx "Lagged asset return"
label var l2share_bond "\addlinespace Lagged bond share"
label var l2share_stock "Lagged stock share"
label var l2share_re "Lagged real estate share"
label var l2share_loan "Lagged loan share"

eststo clear

foreach x in fee_entry fee_mngt {

eststo: reghdfe `x' lx l2share_bond l2share_stock l2share_re l2share_loan [aw=w], a(matricule year) vce(cluster matricule year)

}

estout using "$results/fees-lagassetreturn.tex", replace style(tex) label cells(b(fmt(%9.2g) star) se(fmt(%9.2g) par)) starlevels(* 0.1 ** 0.05 *** 0.01) drop(_cons) collabel(none) mlabel(none) varwidth(40)

estout using "$results/fees-lagassetreturn_r2.tex", replace style(tex) stats(r2_a N, fmt(%8.2g %8.0fc) label("$ R^2$" "Observations")) drop(*) mlabel(none) collabel(none)
